<template>
  <div class="processedFeedback">
    <el-card shadow="never" style="margin-top: 30px">
      <div class="header">
        <div class="page-header">
          <el-page-header @back="goBack" content="已处理反馈" style="margin-bottom: 20px">
          </el-page-header>
        </div>
      </div>

      <el-table
          :data="feedTable"
          style="width: 100%"
          highlight-current-row
          stripe>
        <el-table-column
            label="序号"
            type="index"
            width="50"
            :index="indexMethod">
        </el-table-column>
        <el-table-column
            prop="userName"
            label="用户名"
            width="150"
        >
        </el-table-column>
        <el-table-column
            prop="userPhone"
            label="电话号码"
            width="300"
        >
        </el-table-column>
        <el-table-column
            prop="feedQuestion"
            label="反馈问题"
            >
        </el-table-column>
        <el-table-column
            prop="feedDescription"
            label="反馈描述"
        >
        </el-table-column>
        <el-table-column
            prop="replyContent"
            label="反馈回复">
        </el-table-column>
        <el-table-column
            label="操作"
            width="100">
          <template slot-scope="scope">
            <el-button type="text" size="small" @click="toFeedReplyDetail(scope.row.replyId)">详情</el-button>
          </template>
        </el-table-column>
      </el-table>


      <div style="padding: 10px 0">
        <el-pagination
            :page-sizes="[2, 5, 10, 20]"
            :page-size=this.pageSize
            layout="total, sizes, prev, pager, next, jumper"
            :total=this.total
            :current-page=this.pageNum
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange"
        >
        </el-pagination>
      </div>
    </el-card>
  </div>
</template>

<script>
import {shortTime} from "@/utils/timeFormat";
import {getFeedPage} from "@/api/allApi";

export default {
  name: "ProcessedFeedback",
  data() {
    return {
      feedTable:[],
      pageSize:5,
      total:0,
      pageNum:1,
    }
  },
  methods:{
    goBack() {
      this.$router.back();
    },
    shortTime,
    indexMethod(index) {
      // 当前页数 - 1 * 每页数据条数 + 1
      const page = this.pageNum // 当前页码
      const pagesize = this.pageSize // 每页条数
      return index + 1 + (page - 1) * pagesize
    },
    getFeedPage() {
      getFeedPage({
        current:this.pageNum,
        pageSize:this.pageSize
      }).then(res=>{
        this.feedTable = res.data.data
        this.total = res.data.total
      })
    },
    handleSizeChange(pageSize){
      this.pageSize=pageSize;
      this.getFeedPage();
    },
    handleCurrentChange(pageNum){
      this.pageNum=pageNum;
      this.getFeedPage();
    },
    toFeedReplyDetail(replyId){
      this.$router.push({
        path: "/adminLayout/adminBackground/feedReplyDetail/"+replyId,
      });
    },
  },
  mounted() {
    this.getFeedPage()
  }
}
</script>

<style scoped>

</style>